package tests.testcontainers;

import org.junit.jupiter.api.Test;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import redis.clients.jedis.Jedis;

/**
 * @author 业徽
 * @date 2021/8/12
 */
@Testcontainers
public class SimpleDemo {

    @Container
    public GenericContainer  redis = new GenericContainer(DockerImageName.parse("redis:5.0.3-alpine"))
            .withExposedPorts(6379);


    @Test
    public void test() {
        final Jedis jedis = new Jedis(redis.getHost(), redis.getFirstMappedPort());
        System.out.println(jedis.clientList());
    }

}
